.editable-elements

  - each_editable_element(@blocks, @editable_elements_by_block) do |page, editable_element, index|

    = f.inputs :editable_element do

      = f.simple_fields_for :editable_elements, editable_element, child_index: index do |g|

        = g.hidden_field :_id

        = g.hidden_field :page_id

        - case editable_element.type.to_sym

        - when :editable_text
          = g.input :content, editable_element_input_options(editable_element, index, as: editable_text_format_to_input_type(editable_element), input_html: { rows: editable_element.rows, data: { inline: editable_element.inline? } })

        - when :editable_file
          = g.input :source, editable_element_input_options(editable_element, index, as: :file, select_content_asset: true, resize_format: editable_element.resize_format, hidden_fields: [:content, :default_source_url])

        - when :editable_control
          = g.input :content, editable_element_input_options(editable_element, index, as: :select, collection: (editable_element.options || []).map { |attributes| [attributes['text'], attributes['value']] })

        - when :editable_model
          - if editable_element.content_type?
            fieldset.inputs
              .form-group.input.link.optional data-block=editable_element.block
                label.link.control-label.optional= editable_element_label(editable_element)
                - if editable_element.hint.present?
                  span class="help-inline"= editable_element.hint
                span.form_wrapper
                  = link_to t('.model.buttons.list'), content_entries_path(current_site, editable_element.content_type.slug), class: 'btn btn-primary btn-sm'

